import { getEntireDepartments, getEntrireRoles } from '@/service/main/main'
import {defineStore} from 'pinia'

interface IMainState {
  entireRoles: any
  entireDepartments: any
}

const useMainStore = defineStore('main', {
  state: ():IMainState => ({
    entireRoles: [],
    entireDepartments: []
  }),
  actions: {
    async fetchEntireDataAction() {
      const rolesResult = await getEntrireRoles()
      const departResult = await getEntireDepartments()
      // console.log(rolesResult, departResult)
      this.entireDepartments = departResult.data.list
      this.entireRoles = rolesResult.data.list
    }
  }
})
export default useMainStore